﻿using App.API.Security;
using App.IBLL;
using APP.DTO.ApplicationInfo;
using Microsoft.AspNetCore.Mvc;

namespace App.API.BaseFilter
{
    public class APIControllerBase : ControllerBase
    {
        /// <summary>
        /// 客户端传递的Token
        /// </summary>
        public string RequestToken
        {
            get
            {
                HttpContext.Request.Headers.TryGetValue("Authorization", out Microsoft.Extensions.Primitives.StringValues authStr);
                return authStr;
            }
        }
        /// <summary>
        /// 客户端传递的 Mac地址
        /// </summary>
        public string RequestMACAddress
        {
            get
            {
                HttpContext.Request.Headers.TryGetValue("SecurityMsg", out Microsoft.Extensions.Primitives.StringValues authStr);
                if (!string.IsNullOrWhiteSpace(authStr))
                {
                    string securityMsg = authStr.ToString();
                    string[] tempArray = securityMsg.Split(".");
                    return tempArray[0];
                }

                return authStr;
            }
        }



    }
}
